package com.adong.springboot.listener;

import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
public class MyListener {
    /**
     * 监听某个队列的消息
     *
     * @param message 接收到的消息
     */
    @RabbitListener(queues = "item_queue")
    public void myListener1(String message) {
        System.out.println("消费者接收到的消息为：" + message);
    }

    @RabbitListener(queues = "springboot_queue")
    public void simpleQueue(String message) {
        System.out.println("简单的消息传递：" + message);
    }

    @RabbitListener(queues = "springboot_fanout_queue1")
    public void fanout1Queue(String message) {
        System.out.println("广播1消息传递：" + message);
    }

    @RabbitListener(queues = "springboot_fanout_queue2")
    public void fanout2Queue(String message) {
        System.out.println("广播2消息传递：" + message);
    }


}
